package com.nil.codegen.filter;

import com.nil.codegen.config.AppContext;
import com.nil.codegen.domain.vo.UserInfoVO;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.multipart.MaxUploadSizeExceededException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)  {

        UserInfoVO userInfoVO = new UserInfoVO();
        userInfoVO.setId("1001");
        userInfoVO.setUserName("admin");
        AppContext.setCurrentUser(userInfoVO);

        try {
            filterChain.doFilter(request,response);
        } catch (IOException | ServletException e) {
            System.out.println("a");
        }
    }
}
